import request from './request'

export function query ({currentPage = 1, perPage = 10, roleName, roleType} = {}) {
  return request({
    url: '/system/role/selectRoleList.do',
    method: 'POST',
    body: {currentPage, perPage, roleName, roleType}
  })
}

export function queryMenuAll () {
  return request({
    url: '/system/role/selectMenuAll.do',
    method: 'POST'
  })
}

export function queryRole (id) {
  return request({
    url: '/system/role/selectRoleById.do',
    method: 'POST',
    body: {id}
  })
}

export function create ({roleName, roleType, roleDesc, roleMenu}) {
  return request({
    url: '/system/role/saveRole.do',
    method: 'POST',
    body: {roleName, roleType, roleDesc, roleMenu}
  })
}

export function edit ({id, roleName, roleType, roleDesc, roleMenu}) {
  return request({
    url: '/system/role/updateRoleById.do',
    method: 'POST',
    body: {id, roleName, roleType, roleDesc, roleMenu}
  })
}

export function del (id) {
  return request({
    url: '/system/role/deleteRoleById.do',
    method: 'POST',
    body: {id}
  })
}

export function queryMenu () {
  return request({
    url: '/system/menu/allMenu.do',
    method: 'POST',
    body: {}
  })
}
